package com.xiaochong.tir.trades.thread;

import com.xc.logclient.utils.LogTrace;
import com.xiaochong.tir.common.data.po.ExchangeInfo;
import com.xiaochong.tir.trades.service.KActionQuantizationService;
import com.xiaochong.tir.trades.util.SpringContextUtil;

import java.util.concurrent.CountDownLatch;

/**
 * @Description:  定时跑资金净流入
 * @Author: org
 * @CreateDate: 2018/7/9 10:40
 */
public class KActionQuantizationThread implements Runnable{

    private KActionQuantizationService kActionQuantizationService =
            (KActionQuantizationService) SpringContextUtil.getBean("kActionQuantizationService");
    private Integer exchangeId;//交易所id
    private CountDownLatch countDownLatch;//统计数量

    public KActionQuantizationThread(Integer exchangeId, CountDownLatch countDownLatch) {
        this.exchangeId = exchangeId;
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        LogTrace.beginTrace("k线-5、10、1h资金流入-thread");
        try {
            kActionQuantizationService.kActionQuantization(exchangeId);
        }catch (Exception e){
            e.printStackTrace();
            LogTrace.error("k线-5、10、1h资金流入-thread",e);
        }finally {
            countDownLatch.countDown();
        }
    }
}
